package com.fengmi.mapper;

import com.fengmi.entity.MallGoodsBrand;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 存储库：品牌表
 *
 * @author
 * @date 2022-01-17 19:04:30
 */
@Mapper
public interface MallGoodsBrandMapper {
    //   分页查询及条件查询
    public List<MallGoodsBrand> findPageGoodBrand(MallGoodsBrand mallGoodsBrand);

    //   根据id查询
    @Select("select * from mall_goods_brand where id = #{id}")
    public MallGoodsBrand getOneBrandById(Integer id);

    //   通过id删除某一个品牌
    @Delete("delete  from mall_goods_brand where id=#{id}")
    public int delGoodBrandById(int id);

   //    添加品牌
    @Insert("insert into mall_goods_brand (`name`,first_letter,sort,show_status,product_count,product_comment_count,logo) values\n" +
            "(#{name},#{firstLetter},#{sort},#{showStatus},#{productCount},#{productCommentCount},#{logo})")
    public int addGoodBrand(MallGoodsBrand ma);

    //    修改品牌信息
    public int updateGoodBrand(MallGoodsBrand goods);

    // 修改品牌的状态
    @Update("update mall_goods_brand set show_status=#{status} where id=#{id}")
    public  int updateBrandStatusById(@Param("id") Integer id,@Param("status")Integer status);

    //批量删除
    public int delMore(Integer[] ids);

}